package com.songyang.yougnsql.core.utils;

import java.security.SecureRandom;
import java.util.Random;

/**
 * @ClassName RandomUtil
 * @Description
 * @date 2022/12/5 13:39
 * @Author yanceysong
 * @Version 1.0
 */
public class RandomUtil {
    /**
     * 随机生成固定长度的字节数组
     *
     * @param length 要生成数组的长度
     * @return 生成的数组
     */
    public static byte[] randomBytes(int length) {
        Random r = new SecureRandom();
        byte[] buf = new byte[length];
        r.nextBytes(buf);
        return buf;
    }
}
